﻿using DocumentFormat.OpenXml.Lite.Xml;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace DocumentFormat.OpenXml.Lite.SpreadsheetML.Excel.StyleElements
{
    [XmlRoot("fills", Namespace = Constants.ExcelMain)]
    public class Fills : XmlSerializable
    {
        [Optional]
        [XmlAttribute("count", Form = XmlSchemaForm.Qualified)]
        public Nullable<uint> Count { get; set; }

        [Optional]
        [XmlElement("fill", Namespace = Constants.ExcelMain)]
        public XmlList<Fill> FillList { get; set; }

        public Fills()
        {
            FillList = new XmlList<Fill>();
        }

        public uint AddFill(Fill fill)
        {
            if (Count == null)
            {
                Count = 0;
            }

            Count++;
            FillList.Add(fill);
            return (uint)(Count - 1);
        }
    }
}
